/**
 * 存储localStorage
 */
export const setStore = (name, content) => {
	if(!name) return;
	if(typeof content !== 'string') {
		content = JSON.stringify(content);
	}
	window.localStorage.setItem(name, content);
}

/**
 * 获取localStorage
 */
export const getStore = name => {
	if(!name) return;
	return window.localStorage.getItem(name);
}

/**
 * 删除localStorage
 */
export const removeStore = name => {
	if(!name) return;
	window.localStorage.removeItem(name);
}

/**
 * 获取间隔多天后的日期 格式为09月08日
 * 
 */
export const getDate = (interval,Y) => {
	var ms = interval * 86400000;
	var date = new Date(((new Date).getTime() + ms));
	var year = date.getFullYear();
	var monthY = date.getMonth() + 1;
	var dayY = date.getDate();
	var day = (dayY < 10 ? "0" + dayY : dayY);
	var month = (monthY < 10 ? "0" + monthY : monthY);		
	return Y?year+ "年" +monthY + "月" + dayY + "日":month + "月" + day + "日";
}

export const getDATE = (interval,format) => {
	var ms = interval * 86400000;
	var date = new Date(((new Date).getTime() + ms));
	var year = date.getFullYear();
	var month = date.getMonth() + 1;
	var monthF = (month < 10 ? "0" + month : month);	
	var day = date.getDate();
	var dayF = (day < 10 ? "0" + day : day);
	if(format=="YYYY-MM-DD") return year+"-"+monthF+"-"+dayF;		
}